#pragma region Licensing
/*
       LOGL::GLib -> LorgonJortle's OpenGL Game Library
       Copyright (C) 2011  Jesse 'LorgonJortle' Wilkerson

       This program is free software: you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published by
       the Free Software Foundation, either version 3 of the License, or
       (at your option) any later version.

       This program is distributed in the hope that it will be useful,
       but WITHOUT ANY WARRANTY; without even the implied warranty of
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       GNU General Public License for more details.

       You should have received a copy of the GNU General Public License
       along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#pragma endregion

#include "FrequencyCounter.h"

namespace LOGL_GLib
{
     namespace Utilities
     {
          /******************************************************************************
           FrequencyCounter::FrequencyCounter();
                    Arguments:
                         void

                    Description:
                         Constructs an FrequencyCounter object.

                    Returns:
                         The FrequencyCounter object.
          *******************************************************************************/
          FrequencyCounter::FrequencyCounter()
          {

          }

          /******************************************************************************
           FrequencyCounter::~FrequencyCounter();
                    Arguments:
                         void

                    Description:
                         Deconstructs the FPRCounter object ands free any indebted resources.

                    Returns:
                         void
          *******************************************************************************/
          FrequencyCounter::~FrequencyCounter()
          {
          }

          /******************************************************************************
           GLvoid FrequencyCounter::Tick();
                    Arguments:
                         void

                    Description:
                         Marks the completion of one cycle.

                    Returns:
                         void
          *******************************************************************************/
          GLvoid FrequencyCounter::Tick()
          {
               frames++;
               currentTime = SDL_GetTicks();
               elapsedTime = currentTime - lastUpdateTime;

               if(elapsedTime >= 1000)
               {
                    Frequency = (GLuint)(frames * 1000 / elapsedTime);
                    frames = 0;
                    lastUpdateTime = currentTime;
               }
          }

     } /* Namespace Utilities. */
} /* Namespace LOGL_GLib. */
